

package com.maoshi.shop.platform.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.maoshi.shop.bean.model.User;
import com.maoshi.shop.bean.model.UserAddr;
import com.maoshi.shop.common.util.PageParam;
import com.maoshi.shop.common.util.RedisUtil;
import com.maoshi.shop.security.comment.constants.SecurityConstants;
import com.maoshi.shop.security.comment.model.AppConnect;
import com.maoshi.shop.security.comment.service.AppConnectService;
import com.maoshi.shop.service.UserAddrService;
import com.maoshi.shop.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.web.bind.annotation.*;

import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;


/**
 * @author lgh on 2018/10/16.
 */
@RestController
@RequestMapping("/platform/userAddr")
public class UserAddrController {

    @Autowired
    private UserAddrService userAddrService;

    /**
     * 分页获取
     */
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('plateform:user:page')")
    public ResponseEntity<List<UserAddr>> page(UserAddr userAddr,PageParam<UserAddr> page) {
        List<UserAddr> userAddrPage = userAddrService.list(new LambdaQueryWrapper<UserAddr>()
                .eq(UserAddr::getUserId, userAddr.getUserId()));
        return ResponseEntity.ok(userAddrPage);
    }

}
